<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 结果为几
        f1();
        console.log(c);
        console.log(b);
        console.log(a);

        function f1() {
            var a = b = c = 9; //a = b = c = 9相当于var a = 9;b = 9; c = 9; b和c没有赋值，相当于全局变量
            console.log(c);
            console.log(b);
            console.log(a);
        }

        // 预解析相当于:
        // function f1() {
        //     var a;
        //     a = b = c = 9;
        //     console.log(c); //c = 9;
        //     console.log(b); //b = 9;
        //     console.log(a); // a = 9;
        // }
        // f1();
        // console.log(c); // c = 9;
        // console.log(b); // b = 9;
        // console.log(a); // a 未被定义
    </script>
</body>

</html>